﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using QualityRpt.Service;
using System.Text;

namespace QualityRPT
{
    public partial class LoadData : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        protected void ButtonQ_Click(object sender, EventArgs e)
        {
            DateTime startTime = new DateTime(2013, 12, 02);
            DateTime endTime = new DateTime(2013, 12, 09);
            if (textBoxStart.Text.Trim() != string.Empty)
            {
                startTime = DateTime.Parse(textBoxStart.Text);
                endTime = DateTime.Parse(textBoxEnd.Text);
            }
            DataSet resultSet = TransNoteService.LoadRawData(startTime, endTime, textbox_entry_zh.Text, textbox_entry_zh_msg.Text, textbox_exit_special.Text, textbox_exit_special_msg.Text
                , textbox_exit_zh.Text, textbox_exit_zh_msg.Text, textbox_exit_special.Text, textbox_exit_special_msg.Text);
            this.repeater_load.DataSource = resultSet.Tables[0];
            this.repeater_load.DataBind();
            this.repeater_entry_zh.DataSource = resultSet.Tables[1];
            this.repeater_entry_zh.DataBind();
            this.repeater_entry_special.DataSource = resultSet.Tables[2];
            this.repeater_entry_special.DataBind();
            this.repeater_exit_zh.DataSource = resultSet.Tables[3];
            this.repeater_exit_zh.DataBind();
            this.repeater_exit_special.DataSource = resultSet.Tables[4];
            this.repeater_exit_special.DataBind();
        }
        public string GetStatCount(object sumCnt)
        {
            StringBuilder sbText = new StringBuilder();
            if (sumCnt != DBNull.Value)
            {
                if (Convert.ToInt64(sumCnt) < 100)
                {
                    sbText.Append("<font color='red'>" + sumCnt.ToString() + "</font>");
                }
                else
                {
                    sbText.Append(sumCnt.ToString());
                }
            }
            return sbText.ToString();
        }
    }
}